package com.timoon.component.panel.base;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

public class BaseController {

	protected String BASE_PATH=null;
	
	public void write(HttpServletResponse response,Object str){
		PrintWriter writer=null;
		try {
			response.setContentType("text/xml;charset=UTF-8");  
			response.setHeader("Cache-Control", "no-cache");  
			
			writer=response.getWriter();
			writer.write(str.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			if(writer!=null){
				writer.flush();
				writer.close();
			}
		}
	}
	public void writeMsg(HttpServletResponse response,Boolean success,Object msg){
		String str="{\"success\":\""+success+"\",\"msg\":\""+msg+"\"}";
		this.write(response, str);
	}
}
